using System;
using Anvil.Core;

namespace Anvil.Core.Commands
{
	/// <summary>
	/// Run the delete query indicated by the QueryID property. 
	/// </summary>
	public class BaseDelete : BaseMapper
	{
		public override bool RequestExecute(IRequestContext context)
		{
			int count = Mapper.Delete(QueryID, context);
            context[Tokens.ITEM_COUNT] = count;
			if (count == 0) throw new ApplicationException("Delete: Record not found.");
			return CONTINUE;
		}
	}
}